<? $_api     ="https://".$data['data_detail']['name']."/api/console/seo/site_update.php";?>
<? $_api_http="http://".$data['data_detail']['name']."/api/console/seo/site_update.php";?>

<? $_api_category     ="https://".$data['data_detail']['name']."/api/console/seo/category_update.php";?>
<? $_api_category_http="http://".$data['data_detail']['name']."/api/console/seo/category_update.php";?>


<? $_theme_folder=$data['data_detail']['theme_folder'];?>


<?php $section_title = '基本策略'?>
<?php include ROOT_PATH_."/controller/common/module/mod-section-title.php";?>


<blockquote class="layui-elem-quote">
    本页信息内容，均用接口从网站获取。站点seo会参考产品分类的信息生成。
</blockquote>
<div class="layui-form">
    <textarea type="text" class="layui-textarea" name="ai_seo_setting" ><?echo $seo_require?></textarea>
</div>
<!--2：尽量以How，why ，what的方式命名标题-->



<?php $section_title = '站点信息'?>
<?php include ROOT_PATH_."/controller/common/module/mod-section-title.php";?>


<table class="layui-table">
  <colgroup>
<col >
<col width="30%" >
<col width="30%" >
<col >
  </colgroup>
  <thead>
    <tr>
      <th>项目</th>
      <th>当前信息</th>
      <th>建议优化</th>
      <th>补充要求</th>
      <th>操作</th>
    </tr>
  </thead>  
  <tbody>


  <tr>
      <td>title</td>
      <td><div style="word-break: break-all">
          <?echo $site_seo['title']?>
          </div>
      </td>
      <td><input class="layui-input" data-site-seo="title" value="<?echo $new_site_seo['title']?>"> </td>

      <td>补充要求</td>
      <td>
          <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_site=1" class="layui-btn layui-btn-xs"> AI 生成</a>
          <span class="layui-btn layui-btn-xs"
                onclick="sync_site('title')">
              发送同步</span>
          <span class="layui-btn layui-btn-xs"
                onclick="sync_site_http('title')">
              发送同步2</span>
      </td>
  </tr>


  <tr>
      <td>keyword</td>
      <td><div style="word-break: break-all"><?echo $site_seo['keyword']?></div></td>
      <td><input class="layui-input"  data-site-seo="keyword"  value="<?echo $new_site_seo['keyword']?>"> </td>

      <td>补充要求</td>
      <td>
          <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_site=2" class="layui-btn layui-btn-xs"> AI 生成</a>
          <span class="layui-btn layui-btn-xs"
                onclick="sync_site('keyword')">
                发送同步</span>
          <span class="layui-btn layui-btn-xs"
                onclick="sync_site_http('keyword')">
                发送同步2</span>
      </td>

  </tr>



  <tr>
      <td>description</td>
      <td><div style="word-break: break-all"><?echo $site_seo['description']?></div></td>
      <td><input class="layui-input"  data-site-seo="description"  value="<?echo $new_site_seo['description']?>"> </td>

      <td>补充要求</td>
      <td>
          <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_site=3" class="layui-btn layui-btn-xs"> AI 生成</a>
          <span class="layui-btn layui-btn-xs"
                onclick="sync_site('description')">
                发送同步</span>

          <span class="layui-btn layui-btn-xs"
                onclick="sync_site_http('description')">
                发送同步2</span>

      </td>
  </tr>




  </tbody>
</table>


<script>
    //发送内容到站点，用于更新
    function sync_site(target)
    {


        let url = "<?echo $_api ;?>"
        let theme_folder = "<?echo $_theme_folder ;?>"
        //获取data-ssite-seo 的值
        let content = $("input[data-site-seo='"+target+"']").val()


        console.log(url)
        console.log(target)
        console.log(content)
        console.log(theme_folder)
        $.ajax({
            type: "POST",
            url: url,
            data: {
                target :target,
                content:content,
                theme_folder:theme_folder
            },
            success: function(data){
                console.log(data);
                //刷新当前页面
                location.reload();
            }
        });


    }
</script>



<script>
    //发送内容到站点，用于更新
    function sync_site_http(target)
    {


        let url = "<?echo $_api_http ;?>"
        let theme_folder = "<?echo $_theme_folder ;?>"
        //获取data-ssite-seo 的值
        let content = $("input[data-site-seo='"+target+"']").val()


        console.log(url)
        console.log(target)
        console.log(content)
        console.log(theme_folder)
        $.ajax({
            type: "POST",
            url: url,
            data: {
                target :target,
                content:content,
                theme_folder:theme_folder
            },
            success: function(data){
                console.log(data);
                //刷新当前页面
                location.reload();
            }
        });


    }
</script>
























<?php $section_title = '板块信息'?>
<?php include ROOT_PATH_."/controller/common/module/mod-section-title.php";?>

<table class="layui-table">
    <colgroup>
        <col >
        <col >
        <col >
        <col >
        <col >
        <col >
    </colgroup>
    <thead>
    <tr>
        <th>分类</th>
        <th>项目</th>
        <th>当前信息</th>
        <th>建议优化</th>
        <th>补充要求</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>

<? foreach ($category_seo as $key => $value){?>
    <tr>
        <td><?echo $value['name']?></td>
        <td>title</td>
        <td><?echo $value['title']?></td>

        <td><input class="layui-input"  category_title="<?echo $key?>"  value="<?echo $new_category_seo[$key]['title']?> "> </td>

        <td>补充要求</td>
        <td>
            <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_category=1&category=<?echo $value['name'];?>&key=<?echo $key?>"
               class="layui-btn layui-btn-xs"> AI 生成</a>
            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category('title', <?echo $key?>, <?echo $value['nid']?>)">
                发送同步</span>

            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category_http('title', <?echo $key?>)">
                发送同步2</span>
        </td>
    </tr>


    <tr>
        <td> </td>
        <td>keyword</td>
        <td><?echo $value['keyword']?></td>
        <td><?echo $new_category_seo['keyword']?> </td>

        <td>补充要求</td>
        <td>
            <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_category=2" class="layui-btn layui-btn-xs"> AI 生成</a>
            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category('keyword')">
                发送同步</span>

            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category_http('keyword')">
                发送同步2</span>

        </td>

    </tr>



    <tr>
        <td> </td>
        <td>description</td>
        <td><?echo $value['description']?></td>
        <td><?echo $new_category_seo['description']?> </td>

        <td>补充要求</td>
        <td>
            <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_category=3" class="layui-btn layui-btn-xs"> AI 生成</a>
            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category('description')">
                发送同步</span>

            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category_http('description')">
                发送同步2</span>
        </td>
    </tr>



    <tr>
        <td> </td>
        <td>url</td>
        <td><a href="https://<?echo $data['data_detail']['domain']?>/<?echo $value['url']?>.html"><?echo $value['url']?></a></td>
        <td><?echo $new_category_seo['url']?></td>
        <td>  -- </td>
        <td>
            <a href="data_info.php?<?php echo $data['url_parameter']; ?>&ai_seo_category=3" class="layui-btn layui-btn-xs"> AI 生成</a>
            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category('url')">
                发送同步</span>

            <span class="layui-btn layui-btn-xs"
                  onclick="sync_category_http('url')">
                发送同步2</span>
        </td>
    </tr>
<?}?>

    </tbody>
</table>



<script>
    //发送内容到站点，用于更新
    function sync_category(target,key,nid)
    {


        let url = "<?echo $_api_category ;?>"
        let theme_folder = "<?echo $_theme_folder ;?>"
        let content = $("input[category_title='"+key+"']").val()


        console.log(url)
        console.log(target)
        console.log(content)
        console.log(nid)
        console.log(theme_folder)

//终端程序

        $.ajax({
            type: "POST",
            url: url,
            data: {
                title :content,
                theme_folder:theme_folder
            },
            success: function(data){
                console.log(data);
                //刷新当前页面
                //location.reload();
            }
        });


    }
</script>



<script>
    //发送内容到站点，用于更新
    function sync_category_http(target)
    {


        let url = "<?echo $_api_category_http ;?>"
        let theme_folder = "<?echo $_theme_folder ;?>"
        //获取data-ssite-seo 的值
        let content = $("input[data-site-seo='"+target+"']").val()


        console.log(url)
        console.log(target)
        console.log(content)
        console.log(theme_folder)
        $.ajax({
            type: "POST",
            url: url,
            data: {
                target :target,
                content:content,
                theme_folder:theme_folder
            },
            success: function(data){
                console.log(data);
                //刷新当前页面
                location.reload();
            }
        });


    }
</script>


